﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace FBApp
{
	public class NotificationItem
	{

        public ImageSource Avatar { get; set; }
        public string Message { get; set; }	

        public NotificationItem(NotificationBalloon.NotificationType type,string message)
        {
            BitmapImage bi;            
            switch (type)
            {
                case FBApp.NotificationBalloon.NotificationType.Comment:
                    try
                    {
                        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            bi = new BitmapImage(new Uri("Images/notification.png", UriKind.Relative));
                            Avatar = bi;
                        }
                        ));
                        
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("error: " + ex.Message); 
                    }                    
                    break;
                case FBApp.NotificationBalloon.NotificationType.Like:
                    try
                    {
                        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            bi = new BitmapImage(new Uri("Images/like.png", UriKind.Relative));
                            Avatar = bi;
                        }
                        ));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("error: " + ex.Message);
                    }                       
                    break;
                case FBApp.NotificationBalloon.NotificationType.PhotoTagged:
                    try
                    {
                        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            bi = new BitmapImage(new Uri("Images/notification.png", UriKind.Relative));
                            Avatar = bi;
                        }
                        ));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("error: " + ex.Message);
                    } 
                    break;
                case FBApp.NotificationBalloon.NotificationType.Relationship:
                    try
                    {
                        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            bi = new BitmapImage(new Uri("Images/heart.png", UriKind.Relative));
                            Avatar = bi;
                        }
                        ));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("error: " + ex.Message);
                    } 
                    break;
                case FBApp.NotificationBalloon.NotificationType.Link:
                    try
                    {
                        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
                        {
                            bi = new BitmapImage(new Uri("Images/link.png", UriKind.Relative));
                            Avatar = bi;
                        }
                        ));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("error: " + ex.Message);
                    }
                    break;
            }
            Message = message;
        }
			
	}
}